#include <stdio.h>

void FastSort(int *a,int start,int end)
{
    if(start >= end)
    return;
    int temp = a[start];
    int left = start;
    int right = end;

    while(left < right)
    {
        while(left < right && a[right] > temp)
        {
            right--;
        }
        if(left < right)
        {
            a[left] = a[right];
            left++;
        }

        while(left < right && a[left] < temp)
        {
            left++;
        }
        if(left < right)
        {
            a[right] = a[left];
            right--;
        }
        a[left] = temp;
        FastSort(a,start,left-1);
        FastSort(a,right+1,end);
    }

}

int main()
{
    int a[] = {34,42,1,43,6,3};
    FastSort(a,0,5);
    for(int i = 0; i < 6; i++)
    {
        printf("%d ",a[i]);
    }
    printf("\n");
    return 0;
}
